package main

import (
    "embed"
    "io/fs"
    "log"
    //"net/http"

    "github.com/gofiber/fiber/v3"
    "github.com/gofiber/fiber/v3/middleware/filesystem"
)

// Embed a single file
//go:embed static/index.html
var f embed.FS

// Embed a directory
//go:embed static/*
var embedDirStatic embed.FS

//go:embed static/assets/*
var embedAssets embed.FS

func main() {
    app := fiber.New()

    app.Use("/", filesystem.New(filesystem.Config{
        Root: fs.FS(f),
	
    }))

    // Access file "image.png" under `static/` directory via URL: `http://<server>/static/image.png`.
    // Without `PathPrefix`, you have to access it via URL:
    // `http://<server>/static/static/image.png`.
    app.Use("/assets", filesystem.New(filesystem.Config{
        Root: fs.FS(embedAssets),
        PathPrefix: "/",
        Browse: true,
    }))

	app.Use("/static", filesystem.New(filesystem.Config{
        Root: fs.FS(embedDirStatic),
        PathPrefix: "/",
        Browse: true,
    }))

    log.Fatal(app.Listen(":3000"))
}